package com.mrjy.payment.dao;

import com.mrjy.common.dto.BalanceRechargeDto;
import com.mrjy.common.dto.OrderListDto;
import com.mrjy.common.entity.UserBalancePayment;
import com.mrjy.payment.dto.SpecialPaymentDTO;
import com.mrjy.payment.dto.UserBalancePaymentDto;
import com.mrjy.payment.dto.UserBalancePaymentSchoolDTO;
import com.mrjy.payment.dto.UserBalancePaymentSchoolTotalDTO;

import java.util.Date;
import java.util.List;

public interface IUserBalancePaymentDao {

	Date getTime();
	
	/**
	 * 后台分页查询记录
	 * @param userBalancePayment
	 * @return
	 */
	List<UserBalancePayment> queryPaymentByPage(UserBalancePayment userBalancePayment);
	
	/**
	 * 根据导出表格的列名查出相应的数据
	 * @param userBalancePayment
	 * @return
	 */
	List<OrderListDto> queryExportOrderList(UserBalancePayment userBalancePayment);
	
	/**
	 * 导出充值订单的数据
	 * @param userBalancePayment
	 * @return
	 */
	List<BalanceRechargeDto> queryExportRechargeList(UserBalancePayment userBalancePayment);
	
	/**
	 * 条件查询总数
	 * @param userBalancePayment
	 * @return
	 */
	int getTotalPaymentCount(UserBalancePayment userBalancePayment);
	
	List<UserBalancePayment> queryPaymentByUserId(UserBalancePayment userBalancePayment);
	
	//查询用户是否开通过会员
	List<UserBalancePayment> queryHadPaymentByUserId(UserBalancePayment userBalancePayment);
	
	
	
	//查询未支付订单
	UserBalancePayment queryUnpaidByUserId(UserBalancePayment userBalancePayment);
	
	UserBalancePayment queryById(Integer id);
	//根据订单编号查询
	UserBalancePayment selectByCode(String code);
	//查找已完成订单
	UserBalancePayment selectCompleteByCode(String code);
	//查找未完成订单
	UserBalancePayment selectWaitingByCode(String code);
	
	//插入充值订单
	int insert(UserBalancePayment userBalancePayment);
	
	//插入销售卡充值记录
	int insertCardOrder(UserBalancePayment userBalancePayment);
	
	//更新充值订单信息
	int updatePayment(UserBalancePayment userBalancePayment);
	
	//修改订单删除标志
	int updateDeleteFlag(int[] ids);
	
	int deletePaymentByIds(int[] ids);
	
	/**
	 * 检查用户已经支付订单，还没选择年级号的套餐开通的订单
	 * @param userBalancePayment
	 * @return
	 */
	UserBalancePayment queryPaymentForNoGrade(UserBalancePayment userBalancePayment);
	/**
	 * 查询福卡的信息，用于导出
	 * @param userBalancePayment
	 * @return
	 */
	List<OrderListDto> querySaleCardList(UserBalancePayment userBalancePayment);

	public List<UserBalancePayment> queryListByUserId(Integer userId);

    /**
     * 根据订单code查询充值订单
     *
     * @param code
     * @return
     */
    UserBalancePayment queryPaymentByCode(String code);

    /**
     * 提问过了，那么肯定不可能有偷听支付。
     *
     * @param userBalancePayment
     * @return
     */
    UserBalancePayment queryRecordHadPayment(UserBalancePayment userBalancePayment);
    /**
     * 查询学校推广的学生付费记录
     * @param dto
     * @return
     */
    List<UserBalancePaymentSchoolDTO> querySchoolStudentPaymentBySchoolId(UserBalancePaymentSchoolDTO dto);
    
    int queryCountSchoolStudentPaymentBySchoolId(UserBalancePaymentSchoolDTO dto);
    
    UserBalancePaymentSchoolTotalDTO queryTotalSchoolStudentPaymentBySchoolId(UserBalancePaymentSchoolDTO dto);

    int getTotalCount(UserBalancePayment userBalancePayment);

    int getTotalMoney(UserBalancePayment userBalancePayment);

    int getTotalPayCount(UserBalancePayment userBalancePayment);

    int getTotalPayMoney(UserBalancePayment userBalancePayment);

	UserBalancePayment isDuringActivity(UserBalancePayment userBalancePayment);

	List<String> groupByMoney();

	List<SpecialPaymentDTO> querySpecialPayment(
			UserBalancePayment userBalancePayment);

	UserBalancePaymentDto countSpecialPayment(UserBalancePayment userBalancePayment);
	
	Integer selectRoleIdByPaymentId(Integer id);
}
